<template>
  <div class="outer">
    <h2>List</h2>
    <button @click="sendDataToParent">向APP传递数据</button>
    <button @click="destroyList">卸载自定义事件</button>
  </div>
</template>

<script>
export default {
  name: "List",
  data() {
    return {
      list: [
        { name: "破云", age: 18 },
        { name: "万星", age: 19 },
        { name: "清辞", age: 20 },
      ],
    };
  },
  methods: {
    sendDataToParent() {
      this.$emit("getListData", this.list);
    },
    destroyList(){
      this.$destroy()
    }
  },
  beforeDestroy(){
    this.$off("getListData")
  }
};
</script>

<style>
</style>